<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>

<body>

<div>
    {{info}}
    <input type="button" value="发出异步请求" @click="f1()">
</div>
<!--引入axios和vue框架-->
<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.min.js"></script>
<script src="https://cdn.staticfile.org/vue/2.6.14/vue.min.js"></script>
<script>
    let v = new Vue({
        el: "body>div",
        data:{
            info:"异步测试"
        },
        methods:{
            // 发出异步的get请求
            f1(){
                // 这里的response代表响应对象
                axios.get("/helloAxios").then(function (response) {
                    info = response.data;
                })
            }
        }

    })
</script>

</body>
</html>